package com.cipe.cmrs.bean;

import java.io.Serializable;

public class RestrictedUiElementRoleEntryBean implements Serializable {
		
	/**
	 * 
	 */
	private static final long serialVersionUID = -449625754473508283L;
	private Integer uiElementId;
	private Integer roleId;
	private String nameOrValue;
	private String submenuOrForm;
	private boolean hasRole;	
	
	public RestrictedUiElementRoleEntryBean(Integer uiElementId, Integer roleId, String nameOrValue, String submenuOrForm, boolean hasRole) {
		super();
		this.uiElementId = uiElementId;
		this.roleId = roleId;
		this.nameOrValue = nameOrValue;
		this.submenuOrForm = submenuOrForm;
		this.hasRole = hasRole;
	}

	public RestrictedUiElementRoleEntryBean() {
		super();
	}
	
	public Integer getUiElementId() {
		return uiElementId;
	}

	public void setUiElementId(Integer uiElementId) {
		this.uiElementId = uiElementId;
	}

	public Integer getRoleId() {
		return roleId;
	}

	public void setRoleId(Integer roleId) {
		this.roleId = roleId;
	}

	public String getNameOrValue() {
		return nameOrValue;
	}

	public void setNameOrValue(String nameOrValue) {
		this.nameOrValue = nameOrValue;
	}

	public String getSubmenuOrForm() {
		return submenuOrForm;
	}

	public void setSubmenuOrForm(String submenuOrForm) {
		this.submenuOrForm = submenuOrForm;
	}

	public boolean getHasRole() {
		return hasRole;
	}

	public void setHasRole(boolean hasRole) {
		this.hasRole = hasRole;
	}	

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((roleId == null) ? 0 : roleId.hashCode());
		result = prime * result + ((uiElementId == null) ? 0 : uiElementId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RestrictedUiElementRoleEntryBean other = (RestrictedUiElementRoleEntryBean) obj;
		if (roleId == null) {
			if (other.roleId != null)
				return false;
		} else if (!roleId.equals(other.roleId))
			return false;
		if (uiElementId == null) {
			if (other.uiElementId != null)
				return false;
		} else if (!uiElementId.equals(other.uiElementId))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return roleId + "-" + uiElementId;
	}		
}
